package com.dfrz.listener;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextStartedEvent;
import org.springframework.stereotype.Component;

@Component //让Spring管理监听器
public class CSContextStartedEvent implements ApplicationListener<ContextStartedEvent> {
    @Override
    public void onApplicationEvent(ContextStartedEvent event) {
        System.out.println("************启动监听器事件*************");
        System.out.println("几个监听器中的event都是差不多的");
        System.out.println("只不过几个监听器是在Spring生命周期不同的阶段");
    }
}
